package com.createdevelopment.gaoyou;

import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.ActionBar.LayoutParams;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class VisionActivity extends Activity {
    
	private ImageView cityCard;
	private ImageView cultureView;
	private ImageView economy;
	private ImageView geographyPopulation;
	
	@SuppressLint("NewApi")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_vision);
		findElements();
		cityCard.setOnClickListener(onClickListener);
		cultureView.setOnClickListener(onClickListener);
		economy.setOnClickListener(onClickListener);
		geographyPopulation.setOnClickListener(onClickListener);
		
	}
	
	OnClickListener onClickListener = new OnClickListener() {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent intent = new Intent();
			if(v	==	cityCard){
				intent = new Intent(VisionActivity.this,CityCardActivity.class);
				
			}else if (v == cultureView) {
				
			}else if (v == economy) {
				
			} else if (v == geographyPopulation) {
				
			}
			startActivity(intent);
		}
	};
    
	@SuppressLint("NewApi")
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.vision, menu);
		ActionBar actionBar=this.getActionBar();       
        ActionBar.LayoutParams params=new ActionBar.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT,Gravity.CENTER );
        View view=LayoutInflater.from(this).inflate(R.layout.actionbar_view, null); 
        view.setBackgroundResource(R.drawable.investment_area_header_bg);
        actionBar.setCustomView(view,params);
        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
        actionBar.setDisplayShowCustomEnabled(true);

		return true;
	}
	
	private void findElements(){
		cityCard=(ImageView)this.findViewById(R.id.city_card);
		cultureView=(ImageView)this.findViewById(R.id.culture_view);
		economy=(ImageView)this.findViewById(R.id.economy);
		geographyPopulation=(ImageView)this.findViewById(R.id.geography_population);
	}
}
